<a href="reset.php" target="_new">RESET</a><br>
<a href="assign.php" target="_new">Assign</a><br>
<?php
include_once "methods.php";


$sql  = "select sum((stop - start)/3600) as `Scheduled Hours` ";
$sql .= "from sked";

$results = lom::getit($sql);
simple_table($results);

$sql  = "select sum((stop - start)/3600) as `Needed Hours` ";
$sql .= "from need";

$results = lom::getit($sql);
simple_table($results);

$sql  = "select sum((stop - start)/3600) as `Available Hours` ";
$sql .= "from avail where processed=0";

$results = lom::getit($sql);
simple_table($results);



$sql  = "select employee as `Employee`, (stop - start)/3600 as Hours, from_unixtime(start) as `Start Time`, ";
$sql .= "from_unixtime(stop) as `Stop Time`, auto from sked order by start asc, stop asc";
$results = lom::getit($sql);


simple_table($results);



//
print "<h1>Stats</h1>\n";

$sql  = "select employee as Employee, count(auto) as `Shifts Assigned`, ";
$sql .= "sum((stop - start)/3600) as `Total Hours` ";
$sql .= "from sked group by employee order by sum((stop - start)/3600) asc";

$results = lom::getit($sql);
simple_table($results);

$sql  = "select employee as Employee, count(auto) as `Avail Shifts`, ";
$sql .= "sum((stop - start)/3600) as `Available Hours` ";
$sql .= "from avail group by employee";

$results = lom::getit($sql);
print "<h2>Available</h2>\n";
simple_table($results);



print "<h2>Needs</h2>\n";

$sql  = "select auto, (stop - start)/3600 as Hours, from_unixtime(start) as `Start Time`, ";
$sql .= "from_unixtime(stop) as `Stop Time` from need where processed = 0 order by start asc, stop asc";
$results = lom::getit($sql);
simple_table($results);


print "<h2>AVAIL</h2>\n";
$sql  = "select auto, employee, (stop - start)/3600 as Hours, from_unixtime(start) as `Start Time`, ";
$sql .= "from_unixtime(stop) as `Stop Time`, max, min ";
$sql .= "from avail order by employee, start asc, stop asc";
$results = lom::getit($sql);
simple_table($results);



